package com.wiscamp.ninechapters.problems.infrastructure.converters;

import com.wiscamp.ninechapters.problems.domain.models.mistakes.Mistake;
import com.wiscamp.ninechapters.problems.infrastructure.po.mistakes.MistakePO;
import com.wiscamp.ninechapters.problems.infrastructure.po.mistakes.MistakeView;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface MistakeConverter {
    MistakeConverter Instance = Mappers.getMapper(MistakeConverter.class);
    MistakePO toMistakePO(Mistake entity);

    MistakePO toMistakePO(Mistake entity, @MappingTarget MistakePO po);

    Mistake toMistake(MistakePO po);

    Mistake toMistakeByView(MistakeView view);
}
